#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

template<typename T=int>
inline T read() {
    T x;
    cin >> x;
    return x;
}

int a[10000 + 1], n, cnt = 0;

void select_sort(int *a, int left, int right) {
    if (left >= right)return;
    int p = min_element(a + left, a + right + 1) - a;
    if (left != p) {
        swap(a[left], a[p]);
        ++cnt;
    }

    select_sort(a, left + 1, right);

}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n;
    for (int i = 0; i < n; i++)cin >> a[i];

    select_sort(a, 0, n - 1);
    copy(a, a + n, ostream_iterator<int>(cout, " "));
    cout << endl;
    cout << cnt << endl;

    return 0;
}
